<template>
  <div class="my-goods-item">
    <div class="left">
      <div class="custom-control custom-checkbox">
        <label class="custom-control-label">
          <!-- 小复选框 -->
          <input
            type="checkbox"
            v-model="proObj.goods_state"
            class="custom-control-input"
          />
          <img :src="proObj.goods_img" alt="" />
        </label>
      </div>
    </div>
    <div class="right">
      <div class="top">{{ proObj.goods_name }}</div>
      <div class="bottom">
        <span class="price">¥ {{ proObj.goods_price }}</span>
        <!-- 商品计数器:传入 商品对象 -->
        <span> <Mycount :pro="proObj" /> </span>
      </div>
    </div>
  </div>
</template>

<script>
import Mycount from "./MyCount.vue";
export default {
  // 接收 商品详细数据（实际传递的是 对象的 内存地址）
  props: ["proObj"],
  components: {
    Mycount,
  },
};
</script>

<style lang="less" scoped>
.my-goods-item {
  display: flex;
  padding: 10px;
  border-bottom: 1px solid #ccc;
  .left {
    img {
      width: 120px;
      height: 120px;
      margin-right: 8px;
      border-radius: 10px;
    }
    .custom-control-label::before,
    .custom-control-label::after {
      top: 50px;
    }
  }
  .right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .top {
      font-size: 14px;
      font-weight: 700;
    }
    .bottom {
      display: flex;
      justify-content: space-between;
      padding: 5px 0;
      align-items: center;
      .price {
        color: red;
        font-weight: bold;
      }
    }
  }
}
</style>